home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / pascal / bp7bugs2.zip / OUTLINE.FIX < prev    next >
Text File  |  1992-12-01  |  779b  |  31 lines

  1. The DisposeNode procedure in the Outlines unit neglects to dispose of the
  2. Text string allocated by NewNode.  This means that disposing of a POutline
  3. object leaves all the strings sitting in memory.  It's also got redundant
  4. tests to avoid disposing of a nil pointer.
  5.  
  6. It should be fixed as follows.  Change from:
  7.  
  8.  procedure DisposeNode(Node: PNode);
  9.  begin
  10.   if Node <> nil then
  11.     with Node^ do
  12.     begin
  13.       if ChildList <> nil then DisposeNode(ChildList);
  14.       if Next <> nil then DisposeNode(Next);
  15.     end;
  16.   Dispose(Node);
  17. to:
  18.  
  19.  procedure DisposeNode(Node: PNode);
  20.  begin
  21.   if Node <> nil then
  22.     with Node^ do
  23.     begin
  24.       DisposeNode(ChildList);
  25.       DisposeNode(Next);
  26.       DisposeStr(Text);
  27.       Dispose(Node);
  28.     end;
  29.  end;
  30.  
  31.